<template>
  <view>
    <view class="search-container" :style="{'background-color': bgcolor}">
      <view class="search-box" :style="{'border-radius': radius + 'rpx'}" @click="searchBoxHandler">
        <uni-icons type="search" size="17" ></uni-icons>
        <text class="placeholder">搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-search",
    data() {
      return {

      };
    },
    methods: {
      // 点击了模拟的 input 输入框
      searchBoxHandler() {
        // 触发外界通过 @click 绑定的 click 事件处理函数
        this.$emit('click')
      }
    },
    props:{
      bgcolor: {
          type: String,
          default: '#C00000'
        },
      radius:{
        type:Number,
        default:36
      }
    }
  }
</script>

<style lang="scss">
.search-container{
  height: 100rpx;
  display: flex;
  align-items: center;
  padding: 0rpx 20rpx;
  .search-box{
    position: sticky;
    top: 0;
    z-index: 999;
    color: #3b3b3b;
    width: 100%;
    padding: 0rpx 20rpx;
    height: 72rpx;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    .placeholder{
      margin-left: 10rpx;
      font-size: 30rpx;
    }
  }
}
</style>
